<%@page import="com.pengtu.gsj.entity.base.LabelValue"%>
<%@page import="java.util.List"%>
<%@page import="java.util.Map"%>
<%@page language="java" import="com.pengtu.gsj.utils.LabelHelper" %>
<%@page import="com.pengtu.gsj.utils.encode.JsonBinder"%>
<%@page language="java" contentType="text/javascript" pageEncoding="UTF-8"%>
<%  Map<Integer,List<LabelValue>>  categoryMap =LabelHelper.getInstance().getCategoryMap();%>
 var Pengtu ={};
Pengtu.CodeNames =<%=JsonBinder.buildNonNullBinder().toJson(categoryMap)%>;
Pengtu.buildCodeName = function(category,codeId){
	if(!codeId && typeof(codeId)!="undefined" && codeId!=0){
		return "";
	}
  	var codeNames =  Pengtu.buildCodes(category);
  	 if(codeNames) {
  	  	for(var i=0; i < codeNames.length; i++){
 			if(codeNames[i].value == codeId){
 				return codeNames[i].label;
 			}
	 	}
  	 }
  	  return codeId;
};
Pengtu.buildCodes = function (category,isGroup){
	if(isGroup){
	 var codeNames =  Pengtu.CodeNames[category];
	  if(codeNames) {
    	 return {"results":codeNames,"totalCounts":codeNames.length,"success":true};
     } else {
        return {"results":[{'value':'','label':'没有值'}],"totalCounts":1,"success":true}; 
     }
	}
    var codeNames =  Pengtu.CodeNames[category];
     if(codeNames) {
    	 return codeNames;
     } else {
        return "[{'value':'','label':'没有值'}]";
     }
 	
};
Pengtu.replacebr=function(cellValue){
 if(cellValue!=null){
    	cellValue=cellValue.replace(/　/g,"");//去掉空格
		cellValue=cellValue.replace(/[ ]/g,"");    //去掉空格
		cellValue=cellValue.replace(/[\r\n\t\x]/g,"");//去掉回车换行
     }else{
     	cellValue="";
    }
     return cellValue;
};

